home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / button12.lha / ehandler.ps < prev    next >
Text File  |  1993-08-05  |  3KB  |  66 lines

  1. %!
  2. % lib/ehandler.ps -- Downloaded Error Break-page handler
  3. % GOVERNMENT END USERS: See Notice file in TranScript library directory
  4. % -- probably /usr/lib/ps/Notice
  5. % RCSID: $Header: ehandler.ps,v 2.2 87/11/17 16:39:49 byron Rel $
  6. % assumes serverloop password is the default one
  7. /$brkpage where
  8. {pop(Error Handler in place - not loaded again\n)print flush stop}
  9. {serverdict begin statusdict begin 0000 checkpassword
  10.  {(Error Handler downloaded.\n)print flush 0000 exitserver}
  11.  {(Bad Password on loading error handler!!!\n)print flush stop}ifelse
  12. }ifelse
  13. /$brkpage 64 dict def $brkpage begin
  14. /prnt
  15.  {dup type/stringtype ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def
  16.   currentpoint/toy exch def/tox exch def 1 setgray newpath
  17.   tox toy 2 sub moveto 0 ty rlineto tx 0 rlineto 0 ty neg rlineto
  18.   closepath fill tox toy moveto 0 setgray show}bind def
  19. /nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def
  20. /=={/cp 0 def typeprint nl}def
  21. /typeprint{dup type exec}readonly def
  22. /lmargin 72 def
  23. /rmargin 72 def
  24. /tprint
  25.    {dup length cp add rmargin gt{nl/cp 0 def}if
  26.     dup length cp add/cp exch def prnt}readonly def
  27. /cvsprint{=string cvs tprint( )tprint}readonly def
  28. /integertype{cvsprint}readonly def
  29. /realtype{cvsprint}readonly def
  30. /booleantype{cvsprint}readonly def
  31. /operatortype{(--)tprint =string cvs tprint(-- )tprint}readonly def
  32. /marktype{pop(-mark- )tprint}readonly def
  33. /dicttype{pop(-dictionary- )tprint}readonly def
  34. /nulltype{pop(-null- )tprint}readonly def
  35. /filetype{pop(-filestream- )tprint}readonly def
  36. /savetype{pop(-savelevel- )tprint}readonly def
  37. /fonttype{pop(-fontid- )tprint}readonly def
  38. /nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def
  39. /stringtype
  40.  {dup rcheck{(\()tprint tprint(\))tprint}{pop(-string- )tprint}ifelse
  41.  }readonly def
  42. /arraytype
  43.  {dup rcheck{dup xcheck
  44.   {({)tprint{typeprint}forall(})tprint}
  45.   {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-array- )tprint}ifelse
  46.  }readonly def
  47. /packedarraytype
  48.  {dup rcheck{dup xcheck
  49.   {({)tprint{typeprint}forall(})tprint}
  50.   {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse
  51.  }readonly def
  52. /courier/Courier findfont 10 scalefont def
  53. end %$brkpage
  54. errordict/handleerror
  55.  {systemdict begin $error begin $brkpage begin newerror
  56.    {/newerror false store 
  57.     vmstatus pop pop 0 ne{grestoreall}if initgraphics courier setfont
  58.     lmargin 720 moveto(ERROR: )prnt errorname prnt
  59.     nl(OFFENDING COMMAND: )prnt/command load prnt
  60.     $error/ostack 
  61.     known{nl nl(STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if
  62.     systemdict/showpage get exec(%%[ Error: )print
  63.     errorname =print(; OffendingCommand: )print/command 
  64.     load =print( ]%%)= flush}if end end end}
  65. dup 0 systemdict put dup 4 $brkpage put bind readonly put
  66.